# U-Boot: Cubox-i
# Maintainer: Oleg Rakhmanov <oleg@archlinuxarm.org>
# Maintainer: Kevin Mihelich <kevin@archlinuxarm.org>

buildarch=4

pkgname=uboot-cubox-i
pkgver=2017.01
pkgrel=1
pkgdesc="U-Boot for Cubox-i"
arch=('armv7h')
url="http://git.denx.de/u-boot.git/"
license=('GPL')
makedepends=('git' 'bc')
install=${pkgname}.install
backup=('boot/boot.txt' 'boot/boot.scr')
source=("ftp://ftp.denx.de/pub/u-boot/u-boot-${pkgver}.tar.bz2"
        'boot.txt'
        'mkscr')
md5sums=('ad2d82d5b4fa548b2b95bbc26c9bad79'
         '9d86ff3271d329e1e0dbe3f1a14a7fc8'
         '021623a04afd29ac3f368977140cfbfd')

build() {
  cd u-boot-${pkgver}
  
  unset LDFLAGS CFLAGS CXXFLAGS
  
  make distclean
  make mx6cuboxi_defconfig
  echo 'CONFIG_IDENT_STRING=" Arch Linux ARM"' >> .config
  make
}

package() {
  cd u-boot-${pkgver}

  mkdir -p "${pkgdir}"/boot
  cp SPL u-boot.img "${pkgdir}"/boot

  install -Dm644 ../boot.txt "${pkgdir}"/boot/boot.txt
  tools/mkimage -A arm -O linux -T script -C none -n "U-Boot boot script" -d ../boot.txt "${pkgdir}"/boot/boot.scr
  install -Dm755 ../mkscr "${pkgdir}"/boot/mkscr
}
